﻿using IBLL;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model;

namespace WebApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class MemberController : ControllerBase,IMemberBLL
    {
        public MemberController(IMemberBLL bll)
        {
            Bll = bll;
        }

        public IMemberBLL Bll { get; }
        [HttpPost]
        public async Task<int> AddMember(Member member)
        {
            return await Bll.AddMember(member);
        }
        [HttpDelete]
        public async Task<int> DeleteMember(int id)
        {
            return await Bll.DeleteMember(id);
        }
        [HttpGet]
        public Member FindMember(int id)
        {
            return Bll.FindMember(id);
        }
        [HttpGet]
        public List<Member> GetAllMembers()
        {
            return Bll.GetAllMembers();
        }
        [HttpDelete]
        public async Task<int> IsDel(int id)
        {
            return await Bll.IsDel(id);
        }
        [HttpPut]
        public async Task<int> UpdateMember(Member member)
        {
            return await Bll.UpdateMember(member);
        }
    }
}
